<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <base href="http://localhost/shop-resources/back/">

    <link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
</head>

<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 管理员管理 <span class="c-gray en">&gt;</span>


    管理员列表
    <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新" >
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>

<div class="pd-20">
    <div class="cl pd-5 bg-1 bk-gray mt-20">

        <span class="l">
        <a href="javascript:;" onclick="batchDel()" class="btn btn-danger radius">
            <i class="Hui-iconfont">&#xe6e2;</i> 批量删除
        </a>

        <a href="javascript:;" onclick="admin_add('添加管理员','http://localhost/shop-back/toAddGoodsPage','800','500')" class="btn btn-primary radius">
            <i class="Hui-iconfont">&#xe600;</i> 添加管理员
        </a>

        </span>
    </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="40">ID</th>
                <th width="150">商品名字</th>
                <th width="90">商品类型</th>
                <th width="150">商品的价格</th>
                <th width="150">商品的图片</th>
                <th width="130">商品的描述</th>
                <th width="100">操作</th>
            </tr>
        </thead>
        <tbody>
                <tr class="text-c" th:each="goods:${page.records}">
                    <td><input class="u-id" type="checkbox" th:value="${goods.id}" name=""></td>
                    <td th:text="${goods.id}"></td>
                    <td th:text="${goods.gname}"></td>
                    <td th:text="${goods.gtype}"></td>
                    <td th:text="${goods.gprice}"></td>
                    <td>
                        <img width="60" height="60" th:src="${url}" th:each="url:${#strings.listSplit(goods.gpng,'|')}">
                    </td>
                    <td th:text="${goods.gdesc}"></td>
                    <td class="td-manage">

                        <a title="编辑" href="javascript:;" th:onclick="|admin_edit('用户编辑','http://localhost/shop-back/userController/getUserById/','1','800','500')|"
                           class="ml-5" style="text-decoration:none">
                            <i class="Hui-iconfont">&#xe6df;</i>
                        </a>

                        <a title="删除" href="javascript:;" onclick="admin_del(this,'1')" class="ml-5" style="text-decoration:none">
                            <i class="Hui-iconfont">&#xe6e2;</i>
                        </a>
                    </td>
                </tr>
        </tbody>
    </table>
</div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script>
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript" src="js/ShopUtils.js"></script>
<script type="text/javascript">

    function admin_add(title,url,w,h){
        layer_show(title,url,w,h);
    }

    function admin_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }

    function batchDel(){

        // 1.创建一个数组
        var userIdArray = new Array();

        // 2.获取用户选中的id
        $(".u-id:checked").each(function(index,id){

            // 3.把用户选中的id放到数组中
            userIdArray.push($(id).val());
        });

        // 发送请求
        sendRequestCallback("shop-back/userController/batchDelUser",userIdArray,function(data){
            location.reload();
        });

    }

</script>
</body>
</html>